package com.exception.exceptiondemo.controller;


import com.exception.exceptiondemo.model.Custom;
import com.exception.exceptiondemo.response.AjaxResponse;
import com.exception.exceptiondemo.service.CustomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
public class CustomController {
    @Autowired
    private CustomService customService;


    /**
     * 测试查询成功
     *
     * @return
     */
    @GetMapping("/api/custom/{id}")
    public AjaxResponse getCustom(@PathVariable("id") Long id, @Valid Custom custom) {
        return AjaxResponse.success(customService.getCustom(id));
    }


    /**
     * 测试更新
     *
     * @return
     */
    @PutMapping("/api/custom/{id}")
    public AjaxResponse putCustom(@PathVariable("id") Long id) {
        return customService.putCustom(id);
    }


}
